// 运行在工作者线程中
import { S3 } from "aws-sdk";

const buildS3 = (endpointUrl: string): S3 =>
  new S3({
    accessKeyId: "minio",
    secretAccessKey: "minio123",
    endpoint: endpointUrl,
    s3ForcePathStyle: true,
    signatureVersion: "v4",
    region: "ap-northeast-1",
    logger: {
      log: console.log,
    },
  });

interface S3MinioClientOptions {
  endpointUrl: string;
  bucket: string;
}

interface S3MinioClientUploadOptions {
  key: string;
  body: File;
  contentType: string;
}

class S3MinioClient {
  s3: S3;
  bucket: string;
  constructor(options: S3MinioClientOptions) {
    this.s3 = buildS3(options.endpointUrl);
    this.bucket = options.bucket;
  }
  upload(options: S3MinioClientUploadOptions) {
    
  }
}

export default S3MinioClient;
